package com.richapp.launcher.database.system.mode;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "conditioinsSensor")
public class ConditionSensorModel {

	@DatabaseField(generatedId = true)
	private int id;

	@DatabaseField(columnName = "conditionCycleFlag",defaultValue = "true",canBeNull = false)
	private String conditionCycleFlag; //检测条件是否满一周期
	
	@DatabaseField(columnName = "sceneName",canBeNull = false)
	private String sceneName;   //情景名称
	
	@DatabaseField(columnName = "conditionType",canBeNull = false)
	private int conditionType;	//主条件类型
	
	@DatabaseField(columnName = "conditionSubType",canBeNull = false)
	private int conditionSubType;	//子条件类型
	
	@DatabaseField(columnName = "boxCpuId",canBeNull = false)
	private String boxCpuId;    //机顶盒CPU ID

	@DatabaseField(columnName = "deviceId",canBeNull = false)
	private String deviceId;    //设备类型编号

	@DatabaseField(columnName = "deviceNumber",canBeNull = false)
	private String deviceNumber;    //设备编号

    @DatabaseField(columnName = "way",canBeNull = false)
    private String way; //路数

    @DatabaseField(columnName = "deviceName",canBeNull = false)
    private String deviceName;  //设备名称
	
	@DatabaseField(columnName = "conditionCheckModel")
	private String conditionCheckModel;        ////条件值判断模式，取值大小型(>=<)，分段型(N1,N2,N3)     1|2
	
	@DatabaseField(columnName = "checkAirValue")
	private String checkAirValue;   //要判断的空气质量的值 ，FFFF FF00 00FF 0000
	
	@DatabaseField(columnName = "checkAlarmValue")
	private String checkAlarmValue; //要判断的报警值 true有报警 false无报警
	
	@DatabaseField(columnName = "checkCO2Value")
	private int checkCO2Value;  //要判断的CO2的值
	
	@DatabaseField(columnName = "checkLightValue")
	private int checkLightValue;    //要判断的光照的值
	
	@DatabaseField(columnName = "checkPM25Value")
	private int checkPM25Value; //要判断的PM2.5的值
	
	@DatabaseField(columnName = "checkTemperatureValue")
	private int checkTemperatureValue;  //要判断的温度的值

	@DatabaseField(columnName = "checkHumidityValue")
	private int checkHumidityValue; //要判断的湿度的值


	
	
	
	public ConditionSensorModel() {
		
	}



	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}


	public String getSceneName() {
		return sceneName;
	}


	public void setSceneName(String sceneName) {
		this.sceneName = sceneName;
	}


	public int getConditionType() {
		return conditionType;
	}


	public void setConditionType(int conditionType) {
		this.conditionType = conditionType;
	}


	public int getConditionSubType() {
		return conditionSubType;
	}


	public void setConditionSubType(int conditionSubType) {
		this.conditionSubType = conditionSubType;
	}


	public String getBoxCpuId() {
		return boxCpuId;
	}


	public void setBoxCpuId(String boxCpuId) {
		this.boxCpuId = boxCpuId;
	}


	public String getDeviceId() {
		return deviceId;
	}


	public void setDeviceId(String deviceId) {
		this.deviceId = deviceId;
	}


	public String getDeviceNumber() {
		return deviceNumber;
	}


	public void setDeviceNumber(String deviceNumber) {
		this.deviceNumber = deviceNumber;
	}

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public String getCheckAirValue() {
		return checkAirValue;
	}


	public void setCheckAirValue(String checkAirValue) {
		this.checkAirValue = checkAirValue;
	}


	public String getCheckAlarmValue() {
		return checkAlarmValue;
	}


	public void setCheckAlarmValue(String checkAlarmValue) {
		this.checkAlarmValue = checkAlarmValue;
	}


	public int getCheckCO2Value() {
		return checkCO2Value;
	}


	public void setCheckCO2Value(int checkCO2Value) {
		this.checkCO2Value = checkCO2Value;
	}


	public int getCheckLightValue() {
		return checkLightValue;
	}


	public void setCheckLightValue(int checkLightValue) {
		this.checkLightValue = checkLightValue;
	}


	public int getCheckPM25Value() {
		return checkPM25Value;
	}


	public void setCheckPM25Value(int checkPM25Value) {
		this.checkPM25Value = checkPM25Value;
	}


	public int getCheckTemperatureValue() {
		return checkTemperatureValue;
	}


	public void setCheckTemperatureValue(int checkTemperatureValue) {
		this.checkTemperatureValue = checkTemperatureValue;
	}

	public int getCheckHumidityValue() {
		return checkHumidityValue;
	}

	public void setCheckHumidityValue(int checkHumidityValue) {
		this.checkHumidityValue = checkHumidityValue;
	}

    public String getWay() {
        return way;
    }

    public void setWay(String way) {
        this.way = way;
    }

	public String getConditionCheckModel() {
		return conditionCheckModel;
	}

	public void setConditionCheckModel(String conditionCheckModel) {
		this.conditionCheckModel = conditionCheckModel;
	}

	public int[] getConditionCheckModelArray() {
		return getStringsToIntArray(conditionCheckModel);
	}

	public String getConditionCycleFlag() {
		return conditionCycleFlag;
	}

	public void setConditionCycleFlag(String conditionCycleFlag) {
		this.conditionCycleFlag = conditionCycleFlag;
	}


	private int[] getStringsToIntArray(String times){
        int[] defaultValue = {-1,-1};
		if(times != null){
			String[] strs = times.split("\\|");
			if(strs.length > 0 ){
				for(int i = 0 ; i < strs.length ; i++){
                    defaultValue[i] = "null".equals(strs[i]) ? -1 : Integer.parseInt(strs[i]);
				}
			}
		}
		return defaultValue;
	}


}
